package com.hui.auth.entity;

import java.io.Serializable;
import java.util.List;

/**
 * 系统用户
 * Created by LiaoYunHui on 2017/9/23/023.
 */
public class AuthUser implements Entity, Serializable {

    @Ignore
    private static final long serialVersionUID = -5141761990804965616L;
    @Ignore
    private long id;
    private String userName;
    private String password;
    private String createUser;
    private String createTime;
    private String updateUser;
    private String updateTime;
    private String lastLogin;
    private Integer status;
    @Ignore
    private List<AuthRole> roles;
    @Ignore
    private List<AuthPermission> permissions;

    public String getRoleIds() {
        if (null != roles) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0, j = roles.size(); i < j; i++) {
                if (0 == i) {
                    sb.append(roles.get(i).getId());
                } else {
                    sb.append(",");
                    sb.append(roles.get(i).getId());
                }
            }
            return sb.toString();
        }
        return "";
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getLastLogin() {
        return lastLogin;
    }

    public void setLastLogin(String lastLogin) {
        this.lastLogin = lastLogin;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public List<AuthRole> getRoles() {
        return roles;
    }

    public void setRoles(List<AuthRole> roles) {
        this.roles = roles;
    }

    public List<AuthPermission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<AuthPermission> permissions) {
        this.permissions = permissions;
    }

    @Override
    public String table() {
        return "auth_user";
    }
}
